Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the datatype used for the "stateDiff" override to eth_call #96

Open
wants to merge 4 commits into
base: boba-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions turbo/adapter/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *uint256.Int) (type
// if statDiff is set, all diff will be applied first and then execute the call
// message.
type Account struct {
Nonce *hexutil.Uint64 `json:"nonce"`
Code *hexutility.Bytes `json:"code"`
Balance **hexutil.Big `json:"balance"`
State *map[libcommon.Hash]uint256.Int `json:"state"`
StateDiff *map[libcommon.Hash]uint256.Int `json:"stateDiff"`
Nonce *hexutil.Uint64 `json:"nonce"`
Code *hexutility.Bytes `json:"code"`
Balance **hexutil.Big `json:"balance"`
State *map[libcommon.Hash]uint256.Int `json:"state"`
StateDiff *map[libcommon.Hash]libcommon.Hash `json:"stateDiff"`
}

func NewRevertError(result *core.ExecutionResult) *RevertError {
Expand Down
5 changes: 4 additions & 1 deletion turbo/adapter/ethapi/state_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
libcommon "github.com/ledgerwatch/erigon-lib/common"

"github.com/ledgerwatch/erigon/core/state"
"github.com/ledgerwatch/log/v3"
)

type StateOverrides map[libcommon.Address]Account
Expand Down Expand Up @@ -41,8 +42,10 @@ func (overrides *StateOverrides) Override(state *state.IntraBlockState) error {
// Apply state diff into specified accounts.
if account.StateDiff != nil {
for key, value := range *account.StateDiff {
log.Info("StateDiff override at", "addr", addr, "key", key, "value", value);
key := key
state.SetState(addr, &key, value)
intValue := new(uint256.Int).SetBytes32(value.Bytes())
state.SetState(addr, &key, *intValue)
}
}
}
Expand Down
Loading