forked from ava-labs/subnet-evm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add equality tests * regenerate abis * add extra padding tests * override network upgrades (ava-labs#839) * override network upgrades * genesis network upgrades defaults * fix conflicts * Update plugin/evm/vm.go * update native minter * nativeminter nit test changes * replace fee manager packers * remove generated abis * Update precompile/contracts/feemanager/contract.go Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org> Signed-off-by: Ceyhun Onur <ceyhunonur54@gmail.com> * fix comments * readd pack/unpack tests * add signature tests * remove skip len check vars * add native minter equality tests * add get fee config output fuzz tests * add fee manager fuzz tests * move tests to another test file * move signatures to unpack test * nits --------- Signed-off-by: Ceyhun Onur <ceyhunonur54@gmail.com> Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
- Loading branch information
Showing
23 changed files
with
1,610 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// (c) 2019-2020, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package contract | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// PackOrderedHashesWithSelector packs the function selector and ordered list of hashes into [dst] | ||
// byte slice. | ||
// assumes that [dst] has sufficient room for [functionSelector] and [hashes]. | ||
// Kept for testing backwards compatibility. | ||
func PackOrderedHashesWithSelector(dst []byte, functionSelector []byte, hashes []common.Hash) error { | ||
copy(dst[:len(functionSelector)], functionSelector) | ||
return PackOrderedHashes(dst[len(functionSelector):], hashes) | ||
} | ||
|
||
// PackOrderedHashes packs the ordered list of [hashes] into the [dst] byte buffer. | ||
// assumes that [dst] has sufficient space to pack [hashes] or else this function will panic. | ||
// Kept for testing backwards compatibility. | ||
func PackOrderedHashes(dst []byte, hashes []common.Hash) error { | ||
if len(dst) != len(hashes)*common.HashLength { | ||
return fmt.Errorf("destination byte buffer has insufficient length (%d) for %d hashes", len(dst), len(hashes)) | ||
} | ||
|
||
var ( | ||
start = 0 | ||
end = common.HashLength | ||
) | ||
for _, hash := range hashes { | ||
copy(dst[start:end], hash.Bytes()) | ||
start += common.HashLength | ||
end += common.HashLength | ||
} | ||
return nil | ||
} | ||
|
||
// PackedHash returns packed the byte slice with common.HashLength from [packed] | ||
// at the given [index]. | ||
// Assumes that [packed] is composed entirely of packed 32 byte segments. | ||
// Kept for testing backwards compatibility. | ||
func PackedHash(packed []byte, index int) []byte { | ||
start := common.HashLength * index | ||
end := start + common.HashLength | ||
return packed[start:end] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
[ | ||
{ | ||
"inputs": [], | ||
"name": "getFeeConfig", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "gasLimit", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "targetBlockRate", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "minBaseFee", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "targetGas", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "baseFeeChangeDenominator", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "minBlockGasCost", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "maxBlockGasCost", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "blockGasCostStep", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "getFeeConfigLastChangedAt", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "blockNumber", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "addr", | ||
"type": "address" | ||
} | ||
], | ||
"name": "readAllowList", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "role", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "addr", | ||
"type": "address" | ||
} | ||
], | ||
"name": "setAdmin", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "addr", | ||
"type": "address" | ||
} | ||
], | ||
"name": "setEnabled", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "gasLimit", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "targetBlockRate", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "minBaseFee", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "targetGas", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "baseFeeChangeDenominator", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "minBlockGasCost", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "maxBlockGasCost", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "blockGasCostStep", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "setFeeConfig", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "addr", | ||
"type": "address" | ||
} | ||
], | ||
"name": "setNone", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
} | ||
] |
Oops, something went wrong.