1313// You should have received a copy of the GNU Lesser General Public License
1414// along with the go-ethereum library. If not, see
1515// <http://www.gnu.org/licenses/>.
16- package main
16+ package testprecompile
1717
1818import (
1919 "context"
@@ -34,16 +34,15 @@ import (
3434 "github.com/ava-labs/libevm/libevm"
3535 "github.com/ava-labs/libevm/libevm/ethtest"
3636 "github.com/ava-labs/libevm/libevm/hookstest"
37- "github.com/ava-labs/libevm/libevm/precompilegen/testprecompile"
3837 "github.com/ava-labs/libevm/node"
3938 "github.com/ava-labs/libevm/params"
4039)
4140
4241// Note that the .abi and .bin files are .gitignored as only the generated Go
4342// files are necessary.
44- //go:generate solc -o ./ --overwrite --abi --bin Test .sol
45- //go:generate go run . -in IPrecompile.abi -out ./testprecompile /generated.go -package testprecompile
46- //go:generate go run ../../cmd/abigen --abi PrecompileTest .abi --bin PrecompileTest .bin --pkg main --out ./abigen.gen_test .go --type PrecompileTest
43+ //go:generate solc -o ./ --overwrite --abi --bin IPrecompile.sol TestSuite .sol
44+ //go:generate go run ../ -in IPrecompile.abi -out ./generated.go -package testprecompile
45+ //go:generate go run ../../../ cmd/abigen --abi TestSuite .abi --bin TestSuite .bin --pkg testprecompile --out ./suite.abigen_test .go --type TestSuite
4746
4847func successfulTxReceipt (ctx context.Context , tb testing.TB , client bind.DeployBackend , tx * types.Transaction ) * types.Receipt {
4948 tb .Helper ()
@@ -60,7 +59,7 @@ func TestGeneratedPrecompile(t *testing.T) {
6059
6160 hooks := & hookstest.Stub {
6261 PrecompileOverrides : map [common.Address ]libevm.PrecompiledContract {
63- precompile : testprecompile . New (contract {}),
62+ precompile : New (contract {}),
6463 },
6564 }
6665 extras := hookstest .Register (t , params.Extras [* hookstest.Stub , * hookstest.Stub ]{
@@ -92,13 +91,13 @@ func TestGeneratedPrecompile(t *testing.T) {
9291 txOpts .Value = big .NewInt (1e9 )
9392
9493 client := sim .Client ()
95- _ , tx , test , err := DeployPrecompileTest (txOpts , client , precompile )
96- require .NoError (t , err , "DeployPrecompileTest (...)" )
94+ _ , tx , test , err := DeployTestSuite (txOpts , client , precompile )
95+ require .NoError (t , err , "DeployTestSuite (...)" )
9796 sim .Commit ()
9897 successfulTxReceipt (ctx , t , client , tx )
9998
10099 txOpts .Value = nil
101- suite := & PrecompileTestSession {
100+ suite := & TestSuiteSession {
102101 Contract : test ,
103102 TransactOpts : * txOpts ,
104103 }
@@ -196,11 +195,11 @@ func TestGeneratedPrecompile(t *testing.T) {
196195
197196type contract struct {}
198197
199- var _ testprecompile. Contract = contract {}
198+ var _ Contract = contract {}
200199
201200func (contract ) Fallback (env vm.PrecompileEnvironment , callData []byte ) ([]byte , error ) {
202201 // Note the test-suite assumption of the fallback's behaviour:
203- var _ = (* PrecompileTest ).EchoingFallback
202+ var _ = (* TestSuite ).EchoingFallback
204203 return callData , nil
205204}
206205
0 commit comments