-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jit-add-argv0
- Loading branch information
Showing
53 changed files
with
1,759 additions
and
762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2021-2023, Offchain Labs, Inc. | ||
// For license information, see https://github.com/nitro/blob/master/LICENSE | ||
|
||
package storage | ||
|
||
import ( | ||
"io" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/rlp" | ||
) | ||
|
||
// time.Time doesn't encode as anything in RLP. This fixes that. | ||
// It encodes a timestamp as a uint64 unix timestamp in seconds, | ||
// so any subsecond precision is lost. | ||
type RlpTime time.Time | ||
|
||
type rlpTimeEncoding struct { | ||
Seconds uint64 | ||
Nanos uint64 | ||
} | ||
|
||
func (b *RlpTime) DecodeRLP(s *rlp.Stream) error { | ||
var enc rlpTimeEncoding | ||
err := s.Decode(&enc) | ||
if err != nil { | ||
return err | ||
} | ||
*b = RlpTime(time.Unix(int64(enc.Seconds), int64(enc.Nanos))) | ||
return nil | ||
} | ||
|
||
func (b RlpTime) EncodeRLP(w io.Writer) error { | ||
return rlp.Encode(w, rlpTimeEncoding{ | ||
Seconds: uint64(time.Time(b).Unix()), | ||
Nanos: uint64(time.Time(b).Nanosecond()), | ||
}) | ||
} | ||
|
||
func (b RlpTime) String() string { | ||
return time.Time(b).String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.