Skip to content

Commit

Permalink
Merge branch 'main' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
tak1827 committed Dec 8, 2024
2 parents 2a1d477 + 4e08e52 commit f10996c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contracts/oasys/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var deploymentSets = map[common.Hash]map[uint64]deploymentSet{
1892000: deploymentSet{deployments10},
4089588: deploymentSet{deployments11},
5095900: deploymentSet{deployments12},
5498661: deploymentSet{deployments13},
5527429: deploymentSet{deployments13},
},
params.OasysTestnetGenesisHash: {
1: deploymentSet{deployments0},
Expand Down
2 changes: 1 addition & 1 deletion contracts/oasys/oasys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ func TestDeploy(t *testing.T) {
{1892000, []deployFn{_deployments10}},
{4089588, []deployFn{_deployments11}},
{5095900, []deployFn{_deployments12}},
{5498661, []deployFn{_deployments13}},
{5527429, []deployFn{_deployments13}},
},
},
{
Expand Down
6 changes: 4 additions & 2 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ func (evm *EVM) Interpreter() *EVMInterpreter {
// execution error or failed value transfer.
func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error) {
// Fail if the address is not allowed to call
if IsDeniedToCall(evm.StateDB, addr) {
// Skip the check if this call is readonly (eth_call)
readOnly := evm.Config.NoBaseFee
if !readOnly && IsDeniedToCall(evm.StateDB, addr) {
return nil, 0, ErrUnauthorizedCall
}
// Fail if we're trying to execute above the call depth limit
Expand Down Expand Up @@ -441,7 +443,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
// because this check targets raw transactions from EOA, and `CREATE2`
// within internal transactions is excluded.
// Need to check after nonce increment to evict failed tx from the pool.
if typ == CREATE && !IsAllowedToCreate(evm.StateDB, caller.Address()) {
if evm.depth == 0 && typ == CREATE && !IsAllowedToCreate(evm.StateDB, caller.Address()) {
return nil, common.Address{}, 0, ErrUnauthorizedCreate
}
// We add this to the access list _before_ taking a snapshot. Even if the creation fails,
Expand Down
7 changes: 6 additions & 1 deletion internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,11 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
if err != nil {
return 0, err
}
// Fail if the address is not allowed to call
to := args.To
if to != nil && vm.IsDeniedToCall(state, *to) {
return 0, fmt.Errorf("the calling contract is in denlylist. to: %s", to.Hex())
}
estimate, revert, err := gasestimator.Estimate(ctx, call, opts, gasCap)
if err != nil {
if len(revert) > 0 {
Expand Down Expand Up @@ -1867,7 +1872,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
}
// Fail if the address is not allowed to call
if to != nil && vm.IsDeniedToCall(state, *to) {
return common.Hash{}, fmt.Errorf("the calling contract is in denlylist. to: %s", to)
return common.Hash{}, fmt.Errorf("the calling contract is in denlylist. to: %s", to.Hex())
}

if err := b.SendTx(ctx, tx); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ var (
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ShanghaiTime: newUint64(1721910600), // Thu Jul 25 2024 21:30:00 GMT+0900
CancunTime: newUint64(1734336000), // Mon Dec 16 2024 17:00:00 GMT+0900
CancunTime: newUint64(1734508800), // Wed Dec 18 2024 17:00:00 GMT+0900

Oasys: &OasysConfig{
Period: 15,
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 7 // Minor version component of the current release
VersionPatch = 1 // Patch version component of the current release
VersionPatch = 2 // Patch version component of the current release
VersionMeta = "testnet0" // Version metadata to append to the version string
)

Expand Down

0 comments on commit f10996c

Please sign in to comment.