Skip to content

Commit 359caee

Browse files
chore(vm): remove IsStateful method (ethereum#23)
1 parent 5449ded commit 359caee

File tree

3 files changed

+4
-98
lines changed

3 files changed

+4
-98
lines changed

core/vm/contracts.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ import (
3939
// contract.
4040
type PrecompiledContract interface {
4141
ContractRef
42-
// IsStateful returns true if the precompile contract can execute a state
43-
// transition or if it can access the StateDB.
44-
IsStateful() bool
4542
// RequiredPrice calculates the contract gas used
4643
RequiredGas(input []byte) uint64
4744
// Run runs the precompiled contract
@@ -306,9 +303,6 @@ func (ecrecover) Address() common.Address {
306303
return common.BytesToAddress([]byte{1})
307304
}
308305

309-
// IsStateful returns false.
310-
func (ecrecover) IsStateful() bool { return false }
311-
312306
func (c *ecrecover) RequiredGas(input []byte) uint64 {
313307
return params.EcrecoverGas
314308
}
@@ -353,9 +347,6 @@ func (sha256hash) Address() common.Address {
353347
return common.BytesToAddress([]byte{2})
354348
}
355349

356-
// IsStateful returns false.
357-
func (sha256hash) IsStateful() bool { return false }
358-
359350
// RequiredGas returns the gas required to execute the pre-compiled contract.
360351
//
361352
// This method does not require any overflow checking as the input size gas costs
@@ -378,9 +369,6 @@ func (ripemd160hash) Address() common.Address {
378369
return common.BytesToAddress([]byte{3})
379370
}
380371

381-
// IsStateful returns false.
382-
func (ripemd160hash) IsStateful() bool { return false }
383-
384372
// RequiredGas returns the gas required to execute the pre-compiled contract.
385373
//
386374
// This method does not require any overflow checking as the input size gas costs
@@ -404,9 +392,6 @@ func (dataCopy) Address() common.Address {
404392
return common.BytesToAddress([]byte{4})
405393
}
406394

407-
// IsStateful returns false.
408-
func (dataCopy) IsStateful() bool { return false }
409-
410395
// RequiredGas returns the gas required to execute the pre-compiled contract.
411396
//
412397
// This method does not require any overflow checking as the input size gas costs
@@ -478,9 +463,6 @@ func (bigModExp) Address() common.Address {
478463
return common.BytesToAddress([]byte{5})
479464
}
480465

481-
// IsStateful returns false.
482-
func (bigModExp) IsStateful() bool { return false }
483-
484466
// RequiredGas returns the gas required to execute the pre-compiled contract.
485467
func (c *bigModExp) RequiredGas(input []byte) uint64 {
486468
var (
@@ -626,9 +608,6 @@ func (bn256AddIstanbul) Address() common.Address {
626608
return common.BytesToAddress([]byte{6})
627609
}
628610

629-
// IsStateful returns false.
630-
func (bn256AddIstanbul) IsStateful() bool { return false }
631-
632611
// RequiredGas returns the gas required to execute the pre-compiled contract.
633612
func (c *bn256AddIstanbul) RequiredGas(input []byte) uint64 {
634613
return params.Bn256AddGasIstanbul
@@ -648,9 +627,6 @@ func (bn256AddByzantium) Address() common.Address {
648627
return common.BytesToAddress([]byte{6})
649628
}
650629

651-
// IsStateful returns false.
652-
func (bn256AddByzantium) IsStateful() bool { return false }
653-
654630
// RequiredGas returns the gas required to execute the pre-compiled contract.
655631
func (c *bn256AddByzantium) RequiredGas(input []byte) uint64 {
656632
return params.Bn256AddGasByzantium
@@ -682,9 +658,6 @@ func (bn256ScalarMulIstanbul) Address() common.Address {
682658
return common.BytesToAddress([]byte{7})
683659
}
684660

685-
// IsStateful returns false.
686-
func (bn256ScalarMulIstanbul) IsStateful() bool { return false }
687-
688661
// RequiredGas returns the gas required to execute the pre-compiled contract.
689662
func (c *bn256ScalarMulIstanbul) RequiredGas(input []byte) uint64 {
690663
return params.Bn256ScalarMulGasIstanbul
@@ -704,9 +677,6 @@ func (bn256ScalarMulByzantium) Address() common.Address {
704677
return common.BytesToAddress([]byte{7})
705678
}
706679

707-
// IsStateful returns false.
708-
func (bn256ScalarMulByzantium) IsStateful() bool { return false }
709-
710680
// RequiredGas returns the gas required to execute the pre-compiled contract.
711681
func (c *bn256ScalarMulByzantium) RequiredGas(input []byte) uint64 {
712682
return params.Bn256ScalarMulGasByzantium
@@ -768,9 +738,6 @@ func (bn256PairingIstanbul) Address() common.Address {
768738
return common.BytesToAddress([]byte{8})
769739
}
770740

771-
// IsStateful returns false.
772-
func (bn256PairingIstanbul) IsStateful() bool { return false }
773-
774741
// RequiredGas returns the gas required to execute the pre-compiled contract.
775742
func (c *bn256PairingIstanbul) RequiredGas(input []byte) uint64 {
776743
return params.Bn256PairingBaseGasIstanbul + uint64(len(input)/192)*params.Bn256PairingPerPointGasIstanbul
@@ -790,9 +757,6 @@ func (bn256PairingByzantium) Address() common.Address {
790757
return common.BytesToAddress([]byte{8})
791758
}
792759

793-
// IsStateful returns false.
794-
func (bn256PairingByzantium) IsStateful() bool { return false }
795-
796760
// RequiredGas returns the gas required to execute the pre-compiled contract.
797761
func (c *bn256PairingByzantium) RequiredGas(input []byte) uint64 {
798762
return params.Bn256PairingBaseGasByzantium + uint64(len(input)/192)*params.Bn256PairingPerPointGasByzantium
@@ -810,9 +774,6 @@ func (blake2F) Address() common.Address {
810774
return common.BytesToAddress([]byte{9})
811775
}
812776

813-
// IsStateful returns false.
814-
func (blake2F) IsStateful() bool { return false }
815-
816777
func (c *blake2F) RequiredGas(input []byte) uint64 {
817778
// If the input is malformed, we can't calculate the gas, return 0 and let the
818779
// actual call choke and fault.
@@ -888,9 +849,6 @@ func (bls12381G1Add) Address() common.Address {
888849
return common.BytesToAddress([]byte{10})
889850
}
890851

891-
// IsStateful returns false.
892-
func (bls12381G1Add) IsStateful() bool { return false }
893-
894852
// RequiredGas returns the gas required to execute the pre-compiled contract.
895853
func (c *bls12381G1Add) RequiredGas(input []byte) uint64 {
896854
return params.Bls12381G1AddGas
@@ -935,9 +893,6 @@ func (bls12381G1Mul) Address() common.Address {
935893
return common.BytesToAddress([]byte{11})
936894
}
937895

938-
// IsStateful returns false.
939-
func (bls12381G1Mul) IsStateful() bool { return false }
940-
941896
// RequiredGas returns the gas required to execute the pre-compiled contract.
942897
func (c *bls12381G1Mul) RequiredGas(input []byte) uint64 {
943898
return params.Bls12381G1MulGas
@@ -980,9 +935,6 @@ func (bls12381G1MultiExp) Address() common.Address {
980935
return common.BytesToAddress([]byte{12})
981936
}
982937

983-
// IsStateful returns false.
984-
func (bls12381G1MultiExp) IsStateful() bool { return false }
985-
986938
// RequiredGas returns the gas required to execute the pre-compiled contract.
987939
func (c *bls12381G1MultiExp) RequiredGas(input []byte) uint64 {
988940
// Calculate G1 point, scalar value pair length
@@ -1046,9 +998,6 @@ func (bls12381G2Add) Address() common.Address {
1046998
return common.BytesToAddress([]byte{13})
1047999
}
10481000

1049-
// IsStateful returns false.
1050-
func (bls12381G2Add) IsStateful() bool { return false }
1051-
10521001
// RequiredGas returns the gas required to execute the pre-compiled contract.
10531002
func (c *bls12381G2Add) RequiredGas(input []byte) uint64 {
10541003
return params.Bls12381G2AddGas
@@ -1093,9 +1042,6 @@ func (bls12381G2Mul) Address() common.Address {
10931042
return common.BytesToAddress([]byte{14})
10941043
}
10951044

1096-
// IsStateful returns false.
1097-
func (bls12381G2Mul) IsStateful() bool { return false }
1098-
10991045
// RequiredGas returns the gas required to execute the pre-compiled contract.
11001046
func (c *bls12381G2Mul) RequiredGas(input []byte) uint64 {
11011047
return params.Bls12381G2MulGas
@@ -1138,9 +1084,6 @@ func (bls12381G2MultiExp) Address() common.Address {
11381084
return common.BytesToAddress([]byte{15})
11391085
}
11401086

1141-
// IsStateful returns false.
1142-
func (bls12381G2MultiExp) IsStateful() bool { return false }
1143-
11441087
// RequiredGas returns the gas required to execute the pre-compiled contract.
11451088
func (c *bls12381G2MultiExp) RequiredGas(input []byte) uint64 {
11461089
// Calculate G2 point, scalar value pair length
@@ -1204,9 +1147,6 @@ func (bls12381Pairing) Address() common.Address {
12041147
return common.BytesToAddress([]byte{16})
12051148
}
12061149

1207-
// IsStateful returns false.
1208-
func (bls12381Pairing) IsStateful() bool { return false }
1209-
12101150
// RequiredGas returns the gas required to execute the pre-compiled contract.
12111151
func (c *bls12381Pairing) RequiredGas(input []byte) uint64 {
12121152
return params.Bls12381PairingBaseGas + uint64(len(input)/384)*params.Bls12381PairingPerPairGas
@@ -1292,9 +1232,6 @@ func (bls12381MapG1) Address() common.Address {
12921232
return common.BytesToAddress([]byte{17})
12931233
}
12941234

1295-
// IsStateful returns false.
1296-
func (bls12381MapG1) IsStateful() bool { return false }
1297-
12981235
// RequiredGas returns the gas required to execute the pre-compiled contract.
12991236
func (c *bls12381MapG1) RequiredGas(input []byte) uint64 {
13001237
return params.Bls12381MapG1Gas
@@ -1336,9 +1273,6 @@ func (bls12381MapG2) Address() common.Address {
13361273
return common.BytesToAddress([]byte{18})
13371274
}
13381275

1339-
// IsStateful returns false.
1340-
func (bls12381MapG2) IsStateful() bool { return false }
1341-
13421276
// RequiredGas returns the gas required to execute the pre-compiled contract.
13431277
func (c *bls12381MapG2) RequiredGas(input []byte) uint64 {
13441278
return params.Bls12381MapG2Gas

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ require (
8282
github.com/deepmap/oapi-codegen v1.8.2 // indirect
8383
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
8484
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
85-
github.com/go-logfmt/logfmt v0.4.0 // indirect
8685
github.com/go-ole/go-ole v1.2.1 // indirect
8786
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
8887
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
89-
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
9088
github.com/kylelemons/godebug v1.1.0 // indirect
9189
github.com/mattn/go-runewidth v0.0.9 // indirect
9290
github.com/mitchellh/mapstructure v1.4.1 // indirect

0 commit comments

Comments
 (0)