Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: relocate tm2/std.MemFile in gnovm/std #2910

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
gnostd "github.com/gnolang/gno/gnovm/pkg/std"
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: &gnostd.MemPackage{
Files: []*gnostd.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: &gnostd.MemPackage{
Files: []*gnostd.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: &gnostd.MemPackage{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "",
Path: "",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.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/pkg/gnoenv"
gnostd "github.com/gnolang/gno/gnovm/pkg/std"
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: &gnostd.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnostd.MemFile{
{
Name: "main.gno",
Body: fileBody1,
Expand All @@ -406,9 +406,9 @@ func main() {
}
msg2 := vm.MsgRun{
Caller: caller.GetAddress(),
Package: &std.MemPackage{
Package: &gnostd.MemPackage{
Name: "main",
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "echo",
Path: deploymentPath,
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "echo",
Path: deploymentPath1,
Files: []*std.MemFile{
Files: []*gnostd.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: &gnostd.MemPackage{
Name: "hello",
Path: deploymentPath2,
Files: []*std.MemFile{
Files: []*gnostd.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"
gnostd "github.com/gnolang/gno/gnovm/pkg/std"
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", []*gnostd.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 @@ -17,10 +17,10 @@ import (
"strings"
"time"

gnostd "github.com/gnolang/gno/gnovm/pkg/std"
"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 @@ -358,7 +358,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 := gnostd.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 @@ -9,6 +9,7 @@

"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
gnostd "github.com/gnolang/gno/gnovm/pkg/std"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
Expand Down Expand Up @@ -73,13 +74,13 @@
return errors.Wrap(err, "parsing gas fee coin")
}

memPkg := &std.MemPackage{}
memPkg := &gnostd.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 = []*gnostd.MemFile{

Check warning on line 83 in gno.land/pkg/keyscli/run.go

View check run for this annotation

Codecov / codecov/patch

gno.land/pkg/keyscli/run.go#L83

Added line #L83 was not covered by tests
{
Name: "stdin.gno",
Body: string(data),
Expand All @@ -97,7 +98,7 @@
if err != nil {
return fmt.Errorf("could not read %q: %w", sourcePath, err)
}
memPkg.Files = []*std.MemFile{
memPkg.Files = []*gnostd.MemFile{
{
Name: info.Name(),
Body: string(b),
Expand Down
Loading
Loading