Skip to content

Commit

Permalink
chore: remove std.TestDerivePkgAddr
Browse files Browse the repository at this point in the history
This function declared in the test native functions, can be
subserseded by std.DerivePkdAddr, which has been added afterward.
The 2 functions shares exactly the same code.
  • Loading branch information
tbruyelle committed Apr 6, 2023
1 parent fdd0b61 commit 5251347
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 27 deletions.
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/banktest/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/banktest")

// print main balance before.
mainaddr := std.TestDerivePkgAddr("main")
mainaddr := std.DerivePkgAddr("main")
banker := std.GetBanker(std.BankerTypeReadonly)
mainbal := banker.GetCoins(mainaddr)
println("main before:", mainbal) // plus OrigSend equals 300.
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/banktest/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/banktest")

// simulate a Deposit call.
std.TestSetOrigPkgAddr(banktestAddr)
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/banktest/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
)

func main() {
banktestAddr := std.TestDerivePkgAddr("gno.land/r/demo/banktest")
banktestAddr := std.DerivePkgAddr("gno.land/r/demo/banktest")

// print main balance before.
mainaddr := std.TestDerivePkgAddr("main")
mainaddr := std.DerivePkgAddr("main")
banker := std.GetBanker(std.BankerTypeReadonly)
mainbal := banker.GetCoins(mainaddr)
println("main before:", mainbal) // plus OrigSend equals 300.
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/gnoland/faucet/faucet_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestPackage(t *testing.T) {
var (
adminaddr = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5")
faucetaddr = std.TestDerivePkgAddr("gno.land/r/faucet")
faucetaddr = std.DerivePkgAddr("gno.land/r/faucet")
controlleraddr1 = testutils.TestAddress("controller1")
controlleraddr2 = testutils.TestAddress("controller2")
controlleraddr3 = testutils.TestAddress("controller3")
Expand Down
21 changes: 0 additions & 21 deletions gnovm/tests/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,27 +636,6 @@ func testPackageInjector(store gno.Store, pn *gno.PackageNode) {
m.Context = ctx
},
)
pn.DefineNative("TestDerivePkgAddr",
gno.Flds( // params
"pkgPath", "string",
),
gno.Flds( // results
"addr", "Address",
),
func(m *gno.Machine) {
arg0 := m.LastBlock().GetParams1().TV
pkgPath := arg0.GetString()
pkgAddr := gno.DerivePkgAddr(pkgPath).Bech32()
res0 := gno.Go2GnoValue(
m.Alloc,
m.Store,
reflect.ValueOf(pkgAddr),
)
addrT := store.GetType(gno.DeclaredTypeID("std", "Address"))
res0.T = addrT
m.PushValue(res0)
},
)
// TODO: move elsewhere.
pn.DefineNative("ClearStoreCache",
gno.Flds( // params
Expand Down

0 comments on commit 5251347

Please sign in to comment.