Skip to content

Commit

Permalink
fix(logic): file time is the block height time
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 15, 2023
1 parent 1c86d46 commit a869ec6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions x/logic/interpreter/fs/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import (
)

type Object struct {
reader *bytes.Reader
uri *url.URL
reader *bytes.Reader
uri *url.URL
modTime time.Time
}

func NewObject(src []byte, uri *url.URL) Object {
func NewObject(src []byte, uri *url.URL, modTime time.Time) Object {
return Object{
reader: bytes.NewReader(src),
uri: uri,
reader: bytes.NewReader(src),
uri: uri,
modTime: modTime,
}
}

Expand All @@ -32,7 +34,7 @@ func (o Object) Mode() fs.FileMode {
}

func (o Object) ModTime() time.Time {
return time.Now() // TODO: change time
return o.modTime
}

func (o Object) IsDir() bool {
Expand Down
2 changes: 1 addition & 1 deletion x/logic/interpreter/fs/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ func (w WasmFS) Open(ctx context.Context, uri *url.URL) (fs.File, error) {
return nil, fmt.Errorf("failed decode wasm base64 respone: %w", err)
}

return NewObject(decoded, uri), nil
return NewObject(decoded, uri, sdkCtx.BlockTime()), nil
}

0 comments on commit a869ec6

Please sign in to comment.