From 77341d622fd32699118a7d5a227a140fd1929cb3 Mon Sep 17 00:00:00 2001 From: Dan Laine Date: Fri, 17 Apr 2020 18:13:30 -0400 Subject: [PATCH 1/2] change SN to chain in chain logs --- utils/logging/factory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/logging/factory.go b/utils/logging/factory.go index 112d03c..c5d5f60 100644 --- a/utils/logging/factory.go +++ b/utils/logging/factory.go @@ -43,7 +43,7 @@ func (f *factory) Make() (Logger, error) { // MakeChain ... func (f *factory) MakeChain(chainID ids.ID, subdir string) (Logger, error) { config := f.config - config.MsgPrefix = "SN " + chainID.String() + config.MsgPrefix = "chain " + chainID.String() config.Directory = path.Join(config.Directory, "chain", chainID.String(), subdir) log, err := New(config) From 0f6cad33b179fbbf46e2fc87060d23507612ceae Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Sat, 18 Apr 2020 18:43:14 +0100 Subject: [PATCH 2/2] vms: Add test for avm.VM.Format --- vms/avm/vm_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/vms/avm/vm_test.go b/vms/avm/vm_test.go index cfd09e8..6655d15 100644 --- a/vms/avm/vm_test.go +++ b/vms/avm/vm_test.go @@ -934,3 +934,51 @@ func TestIssueProperty(t *testing.T) { t.Fatal(err) } } + +func TestVMFormat(t *testing.T) { + _, _, vm := GenesisVM(t) + defer ctx.Lock.Unlock() + defer vm.Shutdown() + + tests := []struct { + in string + expected string + }{ + {"", "3D7sudhzUKTYFkYj4Zoe7GgSKhuyP9bYwXunHwhZsmQe1z9Mp-45PJLL"}, + } + for _, tt := range tests { + t.Run(tt.in, func(t *testing.T) { + if res := vm.Format([]byte(tt.in)); tt.expected != res { + t.Errorf("Expected %q, got %q", tt.expected, res) + } + }) + } +} + +func TestVMFormatAliased(t *testing.T) { + _, _, vm := GenesisVM(t) + defer ctx.Lock.Unlock() + defer vm.Shutdown() + + origAliases := ctx.BCLookup + defer func() { ctx.BCLookup = origAliases }() + + tmpAliases := &ids.Aliaser{} + tmpAliases.Initialize() + tmpAliases.Alias(ctx.ChainID, "X") + ctx.BCLookup = tmpAliases + + tests := []struct { + in string + expected string + }{ + {"", "X-45PJLL"}, + } + for _, tt := range tests { + t.Run(tt.in, func(t *testing.T) { + if res := vm.Format([]byte(tt.in)); tt.expected != res { + t.Errorf("Expected %q, got %q", tt.expected, res) + } + }) + } +}