-
Notifications
You must be signed in to change notification settings - Fork 493
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
Feature/c2c temp #3392
Feature/c2c temp #3392
Changes from all commits
32d3f3d
116c06e
9807eab
6cb3a52
52b528b
8aa0728
597fc63
5339cf0
715f511
54db1c7
4e34eba
305d7ab
2baf39b
6657c2b
b3ac9bd
0a6374b
5456323
dc25f10
e466aa1
70ff3c7
b6cbbf3
850f7c7
221955f
d02cb89
e1b4442
46eb760
f51d2d7
02f6cac
5318545
29a10da
741d1ea
94ba758
4860375
4791706
3ac5e0e
c4ef818
493c2ea
b2ca02f
34b3eca
18cd6cd
97e8068
6330862
ac5f839
34e2fbd
de7fe45
678c1ea
3520336
14e889e
8128167
f5bf5ec
9a5d5cd
b73265c
9cdcb39
22a5ebb
0ad9900
6be3ffa
4cb4241
7da1026
a4f9ebe
4d85356
7dcf9d8
2e09ebf
201337a
14bf464
8a335bb
d2289a5
7248b95
2767f1e
55c4fa5
cb1650e
e6e9ac0
52a1a2c
16c3053
35cf3b3
8f62aff
64a406f
ab65611
80dd665
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -565,6 +565,44 @@ func (s base64EncodingSpecMap) getExtraFor(name string) (extra string) { | |
return | ||
} | ||
|
||
// Base64Encoding is an enum for the `base64decode` opcode | ||
type Base64Encoding int | ||
|
||
const ( | ||
// URLEncoding represents the base64url encoding defined in https://www.rfc-editor.org/rfc/rfc4648.html | ||
URLEncoding Base64Encoding = iota | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
// StdEncoding represents the standard encoding of the RFC | ||
StdEncoding | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
invalidBase64Alphabet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
) | ||
|
||
// After running `go generate` these strings will be available: | ||
var base64EncodingNames [2]string = [...]string{URLEncoding.String(), StdEncoding.String()} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
|
||
type base64EncodingSpec struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
field Base64Encoding | ||
ftype StackType | ||
version uint64 | ||
} | ||
|
||
var base64EncodingSpecs = []base64EncodingSpec{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
{URLEncoding, StackBytes, 6}, | ||
{StdEncoding, StackBytes, 6}, | ||
} | ||
|
||
var base64EncodingSpecByField map[Base64Encoding]base64EncodingSpec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
var base64EncodingSpecByName base64EncodingSpecMap | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
|
||
type base64EncodingSpecMap map[string]base64EncodingSpec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
|
||
func (s base64EncodingSpecMap) getExtraFor(name string) (extra string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [Lint Errors] reported by reviewdog 🐶 |
||
// Uses 6 here because base64_decode fields were introduced in 6 | ||
if s[name].version > 6 { | ||
extra = fmt.Sprintf("LogicSigVersion >= %d.", s[name].version) | ||
} | ||
return | ||
} | ||
|
||
// AssetHoldingField is an enum for `asset_holding_get` opcode | ||
type AssetHoldingField int | ||
|
||
|
@@ -854,6 +892,16 @@ func init() { | |
base64EncodingSpecByName[encoding] = base64EncodingSpecByField[Base64Encoding(i)] | ||
} | ||
|
||
base64EncodingSpecByField = make(map[Base64Encoding]base64EncodingSpec, len(base64EncodingNames)) | ||
for _, s := range base64EncodingSpecs { | ||
base64EncodingSpecByField[s.field] = s | ||
} | ||
|
||
base64EncodingSpecByName = make(base64EncodingSpecMap, len(base64EncodingNames)) | ||
for i, encoding := range base64EncodingNames { | ||
base64EncodingSpecByName[encoding] = base64EncodingSpecByField[Base64Encoding(i)] | ||
} | ||
|
||
AssetHoldingFieldNames = make([]string, int(invalidAssetHoldingField)) | ||
for i := AssetBalance; i < invalidAssetHoldingField; i++ { | ||
AssetHoldingFieldNames[int(i)] = i.String() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [Lint Errors] reported by reviewdog 🐶
Base64Encoding
redeclared in this block (typecheck)