Skip to content

Commit

Permalink
Merge branch '1.4.0-candidate' of https://github.com/maticnetwork/bor
Browse files Browse the repository at this point in the history
…into 1.4.0-candidate
  • Loading branch information
pratikspatil024 committed Sep 5, 2024
2 parents 2415826 + 79fd5ca commit da611cd
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 14 deletions.
19 changes: 18 additions & 1 deletion builder/files/genesis-amoy.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions consensus/bor/api/caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import (
"context"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/rpc"
)

//go:generate mockgen -destination=./caller_mock.go -package=api . Caller
type Caller interface {
Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
CallWithState(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *ethapi.StateOverride, blockOverrides *ethapi.BlockOverrides) (hexutil.Bytes, error)
}
8 changes: 4 additions & 4 deletions consensus/bor/contract/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ func (gc *GenesisContractsClient) LastStateId(state *state.StateDB, number uint6
toAddress := common.HexToAddress(gc.StateReceiverContract)
gas := (hexutil.Uint64)(uint64(math.MaxUint64 / 2))

// Do a call with state so that we can fetch the last state ID from a given (incoming)
// state instead of local(canonical) chain.
result, err := gc.ethAPI.Call(context.Background(), ethapi.TransactionArgs{
// BOR: Do a 'CallWithState' so that we can fetch the last state ID from a given (incoming)
// state instead of local(canonical) chain's state.
result, err := gc.ethAPI.CallWithState(context.Background(), ethapi.TransactionArgs{
Gas: &gas,
To: &toAddress,
Data: &msgData,
}, &rpc.BlockNumberOrHash{BlockNumber: &blockNr, BlockHash: &hash}, nil, nil)
}, &rpc.BlockNumberOrHash{BlockNumber: &blockNr, BlockHash: &hash}, state, nil, nil)
if err != nil {
return nil, err
}
Expand Down
26 changes: 23 additions & 3 deletions internal/cli/server/chains/amoy.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ func (e *revertError) ErrorData() interface{} {
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
return s.CallWithState(ctx, args, *blockNrOrHash, nil, overrides, blockOverrides)
return s.CallWithState(ctx, args, blockNrOrHash, nil, overrides, blockOverrides)
}

// CallWithState executes the given transaction on the given state for
Expand All @@ -1389,8 +1389,8 @@ func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrO
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
func (s *BlockChainAPI) CallWithState(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, state *state.StateDB, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
result, err := DoCall(ctx, s.b, args, blockNrOrHash, state, overrides, blockOverrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
func (s *BlockChainAPI) CallWithState(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, state *state.StateDB, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
result, err := DoCall(ctx, s.b, args, *blockNrOrHash, state, overrides, blockOverrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
if err != nil {
return nil, err
}
Expand Down
24 changes: 21 additions & 3 deletions params/config.go

Large diffs are not rendered by default.

0 comments on commit da611cd

Please sign in to comment.