Skip to content

Commit

Permalink
chore: relocate tm2/std.MemFile in gnovm/std (gnolang#2910)
Browse files Browse the repository at this point in the history
This PR removes "gno.land" from all `tm2/.../*.go` files.

---------

Signed-off-by: moul <94029+moul@users.noreply.github.com>
  • Loading branch information
moul authored Oct 25, 2024
1 parent 0b2c67e commit 603f6d3
Show file tree
Hide file tree
Showing 36 changed files with 254 additions and 7,365 deletions.
51 changes: 26 additions & 25 deletions gno.land/pkg/gnoclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/gnolang/gno/gno.land/pkg/gnoland/ugnot"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
ctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/bft/types"
Expand All @@ -17,7 +18,7 @@ import (
"github.com/gnolang/gno/tm2/pkg/std"
)

var testGasFee = ugnot.ValueString(10000)
var testGasFee = ugnot.ValueString(10_000)

func TestRender(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -652,8 +653,8 @@ func main() {

msg := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Files: []*std.MemFile{
Package: &gnovm.MemPackage{
Files: []*gnovm.MemFile{
{
Name: "main.gno",
Body: fileBody,
Expand Down Expand Up @@ -729,8 +730,8 @@ func main() {

msg1 := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Files: []*std.MemFile{
Package: &gnovm.MemPackage{
Files: []*gnovm.MemFile{
{
Name: "main1.gno",
Body: fileBody,
Expand All @@ -742,8 +743,8 @@ func main() {

msg2 := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Files: []*std.MemFile{
Package: &gnovm.MemPackage{
Files: []*gnovm.MemFile{
{
Name: "main2.gno",
Body: fileBody,
Expand Down Expand Up @@ -794,10 +795,10 @@ func TestRunErrors(t *testing.T) {
msgs: []vm.MsgRun{
{
Caller: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -841,10 +842,10 @@ func TestRunErrors(t *testing.T) {
msgs: []vm.MsgRun{
{
Caller: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -872,10 +873,10 @@ func TestRunErrors(t *testing.T) {
msgs: []vm.MsgRun{
{
Caller: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -903,10 +904,10 @@ func TestRunErrors(t *testing.T) {
msgs: []vm.MsgRun{
{
Caller: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -943,7 +944,7 @@ func TestRunErrors(t *testing.T) {
msgs: []vm.MsgRun{
{
Caller: mockAddress,
Package: &std.MemPackage{Name: "", Path: " "},
Package: &gnovm.MemPackage{Name: "", Path: " "},
Send: nil,
},
},
Expand Down Expand Up @@ -993,10 +994,10 @@ func TestAddPackageErrors(t *testing.T) {
msgs: []vm.MsgAddPackage{
{
Creator: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -1040,10 +1041,10 @@ func TestAddPackageErrors(t *testing.T) {
msgs: []vm.MsgAddPackage{
{
Creator: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -1071,10 +1072,10 @@ func TestAddPackageErrors(t *testing.T) {
msgs: []vm.MsgAddPackage{
{
Creator: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -1102,10 +1103,10 @@ func TestAddPackageErrors(t *testing.T) {
msgs: []vm.MsgAddPackage{
{
Creator: mockAddress,
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "file1.gno",
Body: "",
Expand Down Expand Up @@ -1142,7 +1143,7 @@ func TestAddPackageErrors(t *testing.T) {
msgs: []vm.MsgAddPackage{
{
Creator: mockAddress,
Package: &std.MemPackage{Name: "", Path: ""},
Package: &gnovm.MemPackage{Name: "", Path: ""},
Deposit: nil,
},
},
Expand Down
30 changes: 15 additions & 15 deletions gno.land/pkg/gnoclient/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import (

"github.com/gnolang/gno/gnovm/pkg/gnolang"

"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/std"

"github.com/gnolang/gno/gno.land/pkg/gnoland/ugnot"
"github.com/gnolang/gno/gno.land/pkg/integration"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm"
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
"github.com/gnolang/gno/tm2/pkg/crypto"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/log"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -316,9 +316,9 @@ func main() {
// Make Msg configs
msg := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "main.gno",
Body: fileBody,
Expand Down Expand Up @@ -393,9 +393,9 @@ func main() {
// Make Msg configs
msg1 := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "main.gno",
Body: fileBody1,
Expand All @@ -406,9 +406,9 @@ func main() {
}
msg2 := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "main.gno",
Body: fileBody2,
Expand Down Expand Up @@ -474,10 +474,10 @@ func Echo(str string) string {
// Make Msg config
msg := vm.MsgAddPackage{
Creator: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "echo",
Path: deploymentPath,
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: fileName,
Body: body,
Expand Down Expand Up @@ -564,10 +564,10 @@ func Hello(str string) string {

msg1 := vm.MsgAddPackage{
Creator: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "echo",
Path: deploymentPath1,
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "echo.gno",
Body: body1,
Expand All @@ -579,10 +579,10 @@ func Hello(str string) string {

msg2 := vm.MsgAddPackage{
Creator: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnovm.MemPackage{
Name: "hello",
Path: deploymentPath2,
Files: []*std.MemFile{
Files: []*gnovm.MemFile{
{
Name: "gno.mod",
Body: "module gno.land/p/demo/integration/test/hello",
Expand Down
13 changes: 7 additions & 6 deletions gno.land/pkg/gnoland/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"time"

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
gnostd "github.com/gnolang/gno/gnovm/stdlibs/std"
"github.com/gnolang/gno/gnovm"
gnostdlibs "github.com/gnolang/gno/gnovm/stdlibs/std"
"github.com/gnolang/gno/tm2/pkg/amino"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
bft "github.com/gnolang/gno/tm2/pkg/bft/types"
Expand Down Expand Up @@ -53,7 +54,7 @@ func TestNewAppWithOptions(t *testing.T) {
},
Txs: []std.Tx{
{
Msgs: []std.Msg{vm.NewMsgAddPackage(addr, "gno.land/r/demo", []*std.MemFile{
Msgs: []std.Msg{vm.NewMsgAddPackage(addr, "gno.land/r/demo", []*gnovm.MemFile{
{
Name: "demo.gno",
Body: "package demo; func Hello() string { return `hello`; }",
Expand Down Expand Up @@ -308,7 +309,7 @@ func TestEndBlocker(t *testing.T) {
c := newCollector[validatorUpdate](mockEventSwitch, noFilter)

// Fire a GnoVM event
mockEventSwitch.FireEvent(gnostd.GnoEvent{})
mockEventSwitch.FireEvent(gnostdlibs.GnoEvent{})

// Create the EndBlocker
eb := EndBlocker(c, mockVMKeeper, &mockEndBlockerApp{})
Expand Down Expand Up @@ -351,7 +352,7 @@ func TestEndBlocker(t *testing.T) {
c := newCollector[validatorUpdate](mockEventSwitch, noFilter)

// Fire a GnoVM event
mockEventSwitch.FireEvent(gnostd.GnoEvent{})
mockEventSwitch.FireEvent(gnostdlibs.GnoEvent{})

// Create the EndBlocker
eb := EndBlocker(c, mockVMKeeper, &mockEndBlockerApp{})
Expand Down Expand Up @@ -390,7 +391,7 @@ func TestEndBlocker(t *testing.T) {
// Construct the GnoVM events
vmEvents := make([]abci.Event, 0, len(changes))
for index := range changes {
event := gnostd.GnoEvent{
event := gnostdlibs.GnoEvent{
Type: validatorAddedEvent,
PkgPath: valRealm,
}
Expand All @@ -399,7 +400,7 @@ func TestEndBlocker(t *testing.T) {
if index%2 == 0 {
changes[index].Power = 0

event = gnostd.GnoEvent{
event = gnostdlibs.GnoEvent{
Type: validatorRemovedEvent,
PkgPath: valRealm,
}
Expand Down
4 changes: 2 additions & 2 deletions gno.land/pkg/gnoweb/gnoweb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"strings"
"time"

"github.com/gnolang/gno/gnovm"
"github.com/gnolang/gno/tm2/pkg/amino"
abci "github.com/gnolang/gno/tm2/pkg/bft/abci/types"
"github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gorilla/mux"
"github.com/gotuna/gotuna"

Expand Down Expand Up @@ -389,7 +389,7 @@ func handlerPackageFile(logger *slog.Logger, app gotuna.App, cfg *Config) http.H
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
pkgpath := "gno.land/p/" + vars["filepath"]
diruri, filename := std.SplitFilepath(pkgpath)
diruri, filename := gnovm.SplitFilepath(pkgpath)
if filename == "" && diruri == pkgpath {
// redirect to diruri + "/"
http.Redirect(w, r, "/p/"+vars["filepath"]+"/", http.StatusFound)
Expand Down
7 changes: 4 additions & 3 deletions gno.land/pkg/keyscli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/commands"
Expand Down Expand Up @@ -73,13 +74,13 @@ func execMakeRun(cfg *MakeRunCfg, args []string, cmdio commands.IO) error {
return errors.Wrap(err, "parsing gas fee coin")
}

memPkg := &std.MemPackage{}
memPkg := &gnovm.MemPackage{}
if sourcePath == "-" { // stdin
data, err := io.ReadAll(cmdio.In())
if err != nil {
return fmt.Errorf("could not read stdin: %w", err)
}
memPkg.Files = []*std.MemFile{
memPkg.Files = []*gnovm.MemFile{
{
Name: "stdin.gno",
Body: string(data),
Expand All @@ -97,7 +98,7 @@ func execMakeRun(cfg *MakeRunCfg, args []string, cmdio commands.IO) error {
if err != nil {
return fmt.Errorf("could not read %q: %w", sourcePath, err)
}
memPkg.Files = []*std.MemFile{
memPkg.Files = []*gnovm.MemFile{
{
Name: info.Name(),
Body: string(b),
Expand Down
Loading

0 comments on commit 603f6d3

Please sign in to comment.