diff --git a/test/upgradeable/changeAdmin_test.go b/test/upgradeable/changeAdmin_test.go deleted file mode 100644 index 45257eb1..00000000 --- a/test/upgradeable/changeAdmin_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package upgrade_test - -// import ( -// "github.com/ethereum/go-ethereum/common" -// "github.com/ethereum/go-ethereum/core/types" -// "github.com/i-stam/ethertest" -// . "github.com/onsi/ginkgo" -// . "github.com/onsi/gomega" -// "github.com/tokencard/contracts/v3/pkg/bindings/externals/upgradeability" -// . "github.com/tokencard/contracts/v3/test/shared" -// ) - -// var _ = Describe("change Admin", func() { - -// It("should have the wallet owner as the admin", func() { -// admin, err := Proxy.Admin(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(admin).To(Equal(Owner.Address())) -// }) - -// It("Should fail when trying to set it to address 0x0", func() { -// tx, err := Proxy.ChangeAdmin(Owner.TransactOpts(ethertest.WithGasLimit(100000)), common.HexToAddress("0x0")) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeFalse()) -// returnData, _ := ethCall(tx) -// Expect(string(returnData[len(returnData)-64:])).To(ContainSubstring("Cannot change the admin of a proxy to address 0")) -// }) - -// When("trying to set a new admin and the wallet is transferable", func() { -// BeforeEach(func() { -// tx, err := Proxy.ChangeAdmin(Owner.TransactOpts(), RandomAccount.Address()) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) -// }) - -// It("should set the Random account as the admin", func() { -// admin, err := Proxy.Admin(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(admin).To(Equal(RandomAccount.Address())) -// }) - -// It("should emit an AdminChanged event", func() { -// it, err := Proxy.FilterAdminChanged(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(it.Next()).To(BeTrue()) -// evt := it.Event -// Expect(it.Next()).To(BeFalse()) -// Expect(evt.PreviousAdmin).To(Equal(Owner.Address())) -// Expect(evt.NewAdmin).To(Equal(RandomAccount.Address())) -// }) - -// }) - -// When("trying to set a new admin and the wallet is not transferable", func() { - -// // transferOwnership and set transferable to FALSE -// BeforeEach(func() { -// tx, err := ProxyWallet.TransferOwnership(Owner.TransactOpts(), RandomAccount.Address(), false) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) -// }) - -// It("Should fail when trying to set it to a new address", func() { -// tx, err := Proxy.ChangeAdmin(Owner.TransactOpts(ethertest.WithGasLimit(100000)), RandomAccount.Address()) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeFalse()) -// returnData, _ := ethCall(tx) -// Expect(string(returnData[len(returnData)-64:])).To(ContainSubstring("non-transferable proxy admin")) -// }) - -// }) - -// When("there is something wrong on the implementation side", func() { - -// var tx *types.Transaction -// var err error -// // set implementation to an invalid implementation -// BeforeEach(func() { -// ProxyAddress, tx, Proxy, err = upgradeability.DeployAdminUpgradeabilityProxy(BankAccount.TransactOpts(), Backend, ProxyAddress, Owner.Address(), nil) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) -// }) - -// It("Should fail when trying to change Admin", func() { -// tx, err := Proxy.ChangeAdmin(Owner.TransactOpts(ethertest.WithGasLimit(100000)), RandomAccount.Address()) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeFalse()) -// returnData, _ := ethCall(tx) -// Expect(string(returnData[len(returnData)-64:])).To(ContainSubstring("changeAdmin failed")) -// }) - -// }) - -// }) diff --git a/test/upgradeable/upgrade_test.go b/test/upgradeable/upgrade_test.go deleted file mode 100644 index 58c80cba..00000000 --- a/test/upgradeable/upgrade_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package upgrade_test - -// import ( -// "github.com/i-stam/ethertest" -// . "github.com/onsi/ginkgo" -// . "github.com/onsi/gomega" -// "github.com/tokencard/contracts/v3/pkg/bindings/mocks" -// . "github.com/tokencard/contracts/v3/test/shared" -// ) - -// var _ = Describe("upgrade implementation", func() { - -// It("should fail when someone tries to re-initialize", func() { -// tx, err := ProxyWallet.InitializeWallet(BankAccount.TransactOpts(ethertest.WithGasLimit(100000)), RandomAccount.Address(), true, ENSRegistryAddress, TokenWhitelistName, ControllerName, LicenceName, EthToWei(1)) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeFalse()) -// returnData, _ := ethCall(tx) -// Expect(string(returnData[len(returnData)-64:])).To(ContainSubstring("Contract instance has already been initialized")) -// }) - -// It("set the correct wallet implementation", func() { -// imp, err := Proxy.Implementation(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(imp).To(Equal(WalletImplementationAddress)) -// }) - -// It("should set the wallet owner as the admin", func() { -// admin, err := Proxy.Admin(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(admin).To(Equal(Owner.Address())) -// }) - -// When("we increase the nonce", func() { - -// BeforeEach(func() { -// tx, err := ProxyWallet.IncreaseRelayNonce(Owner.TransactOpts()) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) -// }) - -// It("should increase the nonce", func() { -// rn, err := ProxyWallet.RelayNonce(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(rn.String()).To(Equal("1")) -// }) - -// When("we upgrade to a new mock imlementation", func() { - -// BeforeEach(func() { -// WalletMockAddress, tx, _, err := mocks.DeployWalletMock(BankAccount.TransactOpts(), Backend) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) - -// tx, err = Proxy.UpgradeTo(Owner.TransactOpts(), WalletMockAddress) -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) - -// tx, err = ProxyWallet.IncreaseRelayNonce(Owner.TransactOpts()) //new implementation: nonce += 2; -// Expect(err).ToNot(HaveOccurred()) -// Backend.Commit() -// Expect(isSuccessful(tx)).To(BeTrue()) -// }) - -// It("Should return the previous nonce + 2", func() { -// rn, err := ProxyWallet.RelayNonce(nil) -// Expect(err).ToNot(HaveOccurred()) -// Expect(rn.String()).To(Equal("3")) -// }) - -// }) -// }) - -// }) diff --git a/test/upgradeable/upgradeable_suite_test.go b/test/upgradeable/upgradeable_suite_test.go index d9da2dd0..b99e04e6 100644 --- a/test/upgradeable/upgradeable_suite_test.go +++ b/test/upgradeable/upgradeable_suite_test.go @@ -3,6 +3,7 @@ package upgrade_test import ( "context" "fmt" + "os" "testing" "github.com/ethereum/go-ethereum" @@ -78,12 +79,12 @@ var _ = AfterEach(func() { }) -// var _ = AfterSuite(func() { -// if allPassed { -// TestRig.ExpectMinimumCoverage("UpgradeabilityProxy.sol", 98.00) -// TestRig.PrintGasUsage(os.Stdout) -// } -// }) +var _ = AfterSuite(func() { + if allPassed { + TestRig.ExpectMinimumCoverage("externals/upgradeability/UpgradeabilityProxy.sol", 69.00) + TestRig.PrintGasUsage(os.Stdout) + } +}) func isSuccessful(tx *types.Transaction) bool { r, err := Backend.TransactionReceipt(context.Background(), tx.Hash())