Skip to content

Commit

Permalink
Update Random to Hash of Block Timestamp (#1740)
Browse files Browse the repository at this point in the history
* Update Random to Hash of Block Timestamp

* Update hash

* Add comment
  • Loading branch information
Kbhat1 authored Jun 21, 2024
1 parent 3b8b27c commit c5610ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x/evm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
ethstate "github.com/ethereum/go-ethereum/core/state"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/tests"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -189,11 +190,13 @@ func (k *Keeper) GetVMBlockContext(ctx sdk.Context, gp core.GasPool) (*vm.BlockC
if err != nil {
return nil, err
}

// Use hash of block timestamp as info for PREVRANDAO
r, err := ctx.BlockHeader().Time.MarshalBinary()
if err != nil {
return nil, err
}
rh := common.BytesToHash(r)
rh := crypto.Keccak256Hash(r)

txfer := func(db vm.StateDB, sender, recipient common.Address, amount *big.Int) {
if IsPayablePrecompile(&recipient) {
Expand Down

0 comments on commit c5610ba

Please sign in to comment.