(VDB-280) Consume vat contract storage diffs

This commit is contained in:
Rob Mulholand
2019-02-08 13:36:30 -06:00
parent dba4e48a3e
commit c05d3b7836
18 changed files with 2259 additions and 47 deletions
@@ -16,7 +16,9 @@
package shared
import "fmt"
import (
"fmt"
)
type ErrContractNotFound struct {
Contract string
@@ -36,6 +38,14 @@ func (e ErrHeaderMismatch) Error() string {
return fmt.Sprintf("header hash in row does not match db at height %d - row: %s, db: %s", e.BlockHeight, e.DbHash, e.DiffHash)
}
type ErrMetadataMalformed struct {
MissingData Key
}
func (e ErrMetadataMalformed) Error() string {
return fmt.Sprintf("storage metadata malformed: missing %s", e.MissingData)
}
type ErrRowMalformed struct {
Length int
}
+11 -2
View File
@@ -24,10 +24,11 @@ const (
Address
)
type Key int
type Key string
const (
Ilk Key = iota
Ilk Key = "ilk"
Guy Key = "guy"
)
type StorageValueMetadata struct {
@@ -35,3 +36,11 @@ type StorageValueMetadata struct {
Keys map[Key]string
Type ValueType
}
func GetStorageValueMetadata(name string, keys map[Key]string, t ValueType) StorageValueMetadata {
return StorageValueMetadata{
Name: name,
Keys: keys,
Type: t,
}
}