diff options
author | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-04-01 15:05:56 +0800 |
---|---|---|
committer | Jhih-Ming Huang <jm@dexon.org> | 2019-04-03 15:22:28 +0800 |
commit | af4fb11367d92522cae16e1746ef822cacd561e9 (patch) | |
tree | 50b7c5d7dce7823134378b511a5c25d1b9d2a786 /core/vm/sqlvm/ast/types.go | |
parent | 3fef64cc5c864117996b2ae6c85cff49ca1edfa1 (diff) | |
download | dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar.gz dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar.bz2 dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar.lz dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar.xz dexon-af4fb11367d92522cae16e1746ef822cacd561e9.tar.zst dexon-af4fb11367d92522cae16e1746ef822cacd561e9.zip |
core: vm: sqlvm: runtime: opLoad load fixed bytes and address in bytes
To satisfy the latest spec, the data of type of address and fixed bytes will
be stored in bytes instead of decimal value.
Diffstat (limited to 'core/vm/sqlvm/ast/types.go')
-rw-r--r-- | core/vm/sqlvm/ast/types.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/vm/sqlvm/ast/types.go b/core/vm/sqlvm/ast/types.go index 975fd81ba..7d29a5c49 100644 --- a/core/vm/sqlvm/ast/types.go +++ b/core/vm/sqlvm/ast/types.go @@ -358,11 +358,8 @@ func DecimalEncode(dt DataType, d decimal.Decimal) ([]byte, error) { major, minor := DecomposeDataType(dt) switch major { case DataTypeMajorInt, - DataTypeMajorUint, - DataTypeMajorFixedBytes: + DataTypeMajorUint: return decimalEncode(int(minor)+1, d), nil - case DataTypeMajorAddress: - return decimalEncode(common.AddressLength, d), nil } switch { case major.IsFixedRange(): @@ -384,9 +381,7 @@ func DecimalDecode(dt DataType, b []byte) (decimal.Decimal, error) { switch major { case DataTypeMajorInt: return decimalDecode(true, b), nil - case DataTypeMajorUint, - DataTypeMajorFixedBytes, - DataTypeMajorAddress: + case DataTypeMajorUint: return decimalDecode(false, b), nil } switch { |